# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python2-html2text
_pkgname=html2text
pkgver=2019.8.11
pkgrel=6
pkgdesc='Turn HTML into equivalent Markdown-structured text.'
url='https://pypi.org/project/html2text/#files'
arch=('any')
license=('GPL3')
depends=('python2' 'python2-tox' 'python2-coverage')
makedepends=('python2-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('f405bccea18b2898fc8816483e8fa8912b2d508f139d7a65c54218acc87006d8b89e00a12018dc7b911f729036fe4e8a5069242dc00edb40171d4bc149e39ba6')

build() {
  cd "$_pkgname-$pkgver"

  python2 setup.py build
}

package() {
  cd "$_pkgname-$pkgver"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  mv "$pkgdir/usr/bin/$_pkgname" "$pkgdir/usr/bin/${_pkgname}2"

  chmod 644 \
    "$pkgdir/usr/lib/python2.7/site-packages/html2text-2019.8.11-py2.7.egg-info/"*
}

